﻿namespace WinForms.ControlList.Finance
{
    using Bll.Stock;
    using Library;
    using Microsoft.Office.Interop.Excel;
    using PublicStaticClass;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Drawing.Printing;
    using System.Threading;
    using System.Windows.Forms;
    using WinForms;
    using WinForms.Properties;

    public class FrmInvoicingList : Form
    {
        private DataGridViewTextBoxColumn Amount;
        private DataGridViewTextBoxColumn AmoutUnit;
        private System.Windows.Forms.Button btn_BuildProExcel;
        private System.Windows.Forms.Button btn_PrintJinHuo;
        private System.Windows.Forms.Button btnSearch;
        private System.Windows.Forms.Button btnSearchHidden;
        private DataGridViewTextBoxColumn CommName;
        private IContainer components = null;
        private DataGridViewTextBoxColumn CreateTime;
        private DataGridView DataGridList;
        private DataGridViewTextBoxColumn DetailsType;
        private DataGridViewTextBoxColumn InputPrice;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label lbl_PiHao;
        private System.Windows.Forms.Label lblLiuXiangWhere;
        private System.Windows.Forms.Label lblTitle;
        private System.Windows.Forms.Label lblWhere;
        private DataGridViewTextBoxColumn LibraryType;
        private DataGridViewTextBoxColumn LotNum;
        private DataGridViewPrinter MyDataGridViewPrinter;
        private PrintDocument MyPrintDocument;
        private Navigator navigator_Page;
        private DataGridViewTextBoxColumn OutInCommId;
        private Panel pan_AllPanel;
        private Panel pan_AllPlanes;
        private Panel pan_Bottoms;
        private Panel pan_Dock;
        private Panel pan_DockBottom;
        private Panel pan_DockLeft;
        private Panel pan_DockRight;
        private Panel pan_Lefts;
        private Panel pan_Rights;
        private Panel pan_Top;
        private Panel pan_TopJianGe;
        private Panel pan_TopLeft;
        private Panel pan_TopRight;
        private Panel pan_ZhongJian;
        private Panel pane_TopT;
        private Panel panel1;
        private Panel panel10;
        private Panel panel11;
        private Panel panel12;
        private Panel panel13;
        private Panel panel16;
        private Panel panel17;
        private Panel panel18;
        private Panel panel19;
        private Panel panel2;
        private Panel panel20;
        private Panel panel22;
        private Panel panel23;
        private Panel panel3;
        private Panel panel4;
        private Panel panel7;
        private Panel panel8;
        private Panel panel9;
        private Panel PlSearch;
        private DataGridViewTextBoxColumn ResidualMoney;
        private DataGridViewTextBoxColumn ResidualNum;
        private SaveFileDialog saveYeWuLiuXiangDialog;
        private TabControl tabControl1;
        private TabPage tabPage1;
        private System.Windows.Forms.TextBox txt_CommName;
        private System.Windows.Forms.TextBox txt_PiHao;

        public FrmInvoicingList()
        {
            this.InitializeComponent();
        }

        private void btn_BuildProExcel_Click(object sender, EventArgs e)
        {
            if (this.saveYeWuLiuXiangDialog.ShowDialog() == DialogResult.OK)
            {
                System.Data.DataTable dt = LibraryDetailsCommBll.SearchData(this.lblLiuXiangWhere.Text);
                this.DataZhuanHuan(ref dt);
                ParameterizedThreadStart start = new ParameterizedThreadStart(this.BuildExcel);
                Thread thread = new Thread(start);
                object parameter = dt;
                thread.Start(parameter);
            }
        }

        private void btn_PrintJinHuo_Click(object sender, EventArgs e)
        {
            if (this.SetupThePrinting())
            {
                System.Data.DataTable dt = LibraryDetailsCommBll.SearchData(this.lblLiuXiangWhere.Text);
                this.DataZhuanHuan(ref dt);
                this.DataGridList.DataSource = dt;
                new PrintPreviewDialog { Document = this.MyPrintDocument }.ShowDialog();
                this.DataLoad();
            }
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            this.lblLiuXiangWhere.Text = "";
            if (this.txt_PiHao.Text != "")
            {
                this.lblLiuXiangWhere.Text = this.lblLiuXiangWhere.Text + " and T_LibraryDetailsComm.LotNum like '%" + this.txt_PiHao.Text + "%'";
            }
            if (this.txt_CommName.Text != "")
            {
                this.lblLiuXiangWhere.Text = this.lblLiuXiangWhere.Text + " and T_LibraryDetailsComm.CommName like '%" + this.txt_CommName.Text + "%'";
            }
            this.DataLoad();
            this.navigator_Page.PageSize = 0x11;
            this.navigator_Page.DataContainer = this.DataGridList;
            this.navigator_Page.Init();
            this.navigator_Page.PageSize = 0x11;
            this.navigator_Page.DataContainer = this.DataGridList;
            this.navigator_Page.DataBind();
        }

        private void btnSearchHidden_Click(object sender, EventArgs e)
        {
            if (this.PlSearch.Visible)
            {
                this.btnSearchHidden.Text = "显示查询";
                this.PlSearch.Visible = false;
            }
            else
            {
                this.btnSearchHidden.Text = "隐藏查询";
                this.PlSearch.Visible = true;
            }
        }

        public void BuildExcel(object dTable)
        {
            System.Data.DataTable dt = (System.Data.DataTable) dTable;
            BuildNewExcel.outPutExcel(this.DataGridList, dt, this.saveYeWuLiuXiangDialog.FileName);
            if (MessageBox.Show("明细账生成成功,是否现在就打开?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
            {
                Microsoft.Office.Interop.Excel.Application application = new ApplicationClass();
                Workbook workbook = application.Application.Workbooks.Add(this.saveYeWuLiuXiangDialog.FileName);
                application.Visible = true;
            }
        }

        private void DataLoad()
        {
            try
            {
                System.Data.DataTable dt = new System.Data.DataTable();
                int pageCurrent = this.navigator_Page.PageCurrent;
                if (this.lblLiuXiangWhere.Text != "")
                {
                    dt = LibraryDetailsCommBll.SearchData(0x11, pageCurrent, this.lblLiuXiangWhere.Text);
                }
                else
                {
                    dt = LibraryDetailsCommBll.SearchData(0x11, pageCurrent, "");
                }
                this.DataGridList.AutoGenerateColumns = false;
                this.DataZhuanHuan(ref dt);
                int searchDataCount = LibraryDetailsCommBll.GetSearchDataCount(this.lblLiuXiangWhere.Text);
                this.DataGridList.DataSource = dt;
                this.navigator_Page.DataSource = dt;
                this.navigator_Page.RowCount = searchDataCount;
            }
            catch (Exception)
            {
            }
        }

        protected void DataZhuanHuan(ref System.Data.DataTable dt)
        {
            dt.Columns["DetailsType"].ColumnName = "DetailsType1";
            dt.Columns.Add("DetailsType");
            dt.Columns.Remove("OutInCommId");
            dt.Columns.Add("OutInCommId");
            int num = 1;
            foreach (DataRow row in dt.Rows)
            {
                row["OutInCommId"] = num;
                if (row["DetailsType1"].ToString() == "1")
                {
                    row["DetailsType"] = "出库";
                }
                else if (row["DetailsType1"].ToString() == "0")
                {
                    row["DetailsType"] = "入库";
                }
                else
                {
                    row["DetailsType"] = "移库";
                }
                num++;
            }
            dt.Columns.Remove("DetailsType1");
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void FrmInvoicingList_Load(object sender, EventArgs e)
        {
            this.DataLoad();
            this.navigator_Page.PageSize = PublicAppliction.PageCount;
            this.navigator_Page.DataContainer = this.DataGridList;
            this.navigator_Page.Init();
        }

        private void InitializeComponent()
        {
            DataGridViewCellStyle style = new DataGridViewCellStyle();
            DataGridViewCellStyle style2 = new DataGridViewCellStyle();
            DataGridViewCellStyle style3 = new DataGridViewCellStyle();
            DataGridViewCellStyle style4 = new DataGridViewCellStyle();
            DataGridViewCellStyle style5 = new DataGridViewCellStyle();
            DataGridViewCellStyle style6 = new DataGridViewCellStyle();
            DataGridViewCellStyle style7 = new DataGridViewCellStyle();
            DataGridViewCellStyle style8 = new DataGridViewCellStyle();
            DataGridViewCellStyle style9 = new DataGridViewCellStyle();
            DataGridViewCellStyle style10 = new DataGridViewCellStyle();
            DataGridViewCellStyle style11 = new DataGridViewCellStyle();
            DataGridViewCellStyle style12 = new DataGridViewCellStyle();
            this.pan_DockLeft = new Panel();
            this.pan_Dock = new Panel();
            this.pan_AllPanel = new Panel();
            this.pan_AllPlanes = new Panel();
            this.tabControl1 = new TabControl();
            this.tabPage1 = new TabPage();
            this.DataGridList = new DataGridView();
            this.OutInCommId = new DataGridViewTextBoxColumn();
            this.DetailsType = new DataGridViewTextBoxColumn();
            this.LibraryType = new DataGridViewTextBoxColumn();
            this.LotNum = new DataGridViewTextBoxColumn();
            this.CommName = new DataGridViewTextBoxColumn();
            this.InputPrice = new DataGridViewTextBoxColumn();
            this.Amount = new DataGridViewTextBoxColumn();
            this.AmoutUnit = new DataGridViewTextBoxColumn();
            this.ResidualNum = new DataGridViewTextBoxColumn();
            this.ResidualMoney = new DataGridViewTextBoxColumn();
            this.CreateTime = new DataGridViewTextBoxColumn();
            this.PlSearch = new Panel();
            this.panel17 = new Panel();
            this.txt_CommName = new System.Windows.Forms.TextBox();
            this.panel18 = new Panel();
            this.label2 = new System.Windows.Forms.Label();
            this.panel22 = new Panel();
            this.txt_PiHao = new System.Windows.Forms.TextBox();
            this.panel23 = new Panel();
            this.lbl_PiHao = new System.Windows.Forms.Label();
            this.panel13 = new Panel();
            this.panel10 = new Panel();
            this.panel12 = new Panel();
            this.lblLiuXiangWhere = new System.Windows.Forms.Label();
            this.lblWhere = new System.Windows.Forms.Label();
            this.panel11 = new Panel();
            this.navigator_Page = new Navigator();
            this.panel4 = new Panel();
            this.panel8 = new Panel();
            this.panel1 = new Panel();
            this.panel7 = new Panel();
            this.btn_PrintJinHuo = new System.Windows.Forms.Button();
            this.panel16 = new Panel();
            this.btn_BuildProExcel = new System.Windows.Forms.Button();
            this.panel19 = new Panel();
            this.btnSearch = new System.Windows.Forms.Button();
            this.panel20 = new Panel();
            this.btnSearchHidden = new System.Windows.Forms.Button();
            this.panel3 = new Panel();
            this.panel2 = new Panel();
            this.pan_TopJianGe = new Panel();
            this.panel9 = new Panel();
            this.pan_Rights = new Panel();
            this.pan_Lefts = new Panel();
            this.pan_Bottoms = new Panel();
            this.pane_TopT = new Panel();
            this.pan_DockBottom = new Panel();
            this.pan_DockRight = new Panel();
            this.pan_Top = new Panel();
            this.pan_ZhongJian = new Panel();
            this.lblTitle = new System.Windows.Forms.Label();
            this.pan_TopRight = new Panel();
            this.pan_TopLeft = new Panel();
            this.saveYeWuLiuXiangDialog = new SaveFileDialog();
            this.MyPrintDocument = new PrintDocument();
            this.pan_Dock.SuspendLayout();
            this.pan_AllPanel.SuspendLayout();
            this.pan_AllPlanes.SuspendLayout();
            this.tabControl1.SuspendLayout();
            this.tabPage1.SuspendLayout();
            ((ISupportInitialize) this.DataGridList).BeginInit();
            this.PlSearch.SuspendLayout();
            this.panel17.SuspendLayout();
            this.panel18.SuspendLayout();
            this.panel22.SuspendLayout();
            this.panel23.SuspendLayout();
            this.panel10.SuspendLayout();
            this.panel12.SuspendLayout();
            this.panel11.SuspendLayout();
            this.panel1.SuspendLayout();
            this.panel7.SuspendLayout();
            this.panel16.SuspendLayout();
            this.panel19.SuspendLayout();
            this.panel20.SuspendLayout();
            this.pan_Top.SuspendLayout();
            this.pan_ZhongJian.SuspendLayout();
            base.SuspendLayout();
            this.pan_DockLeft.BackColor = Color.FromArgb(0xaf, 0xbf, 190);
            this.pan_DockLeft.Dock = DockStyle.Left;
            this.pan_DockLeft.Location = new System.Drawing.Point(0, 0);
            this.pan_DockLeft.Name = "pan_DockLeft";
            this.pan_DockLeft.Size = new Size(1, 0x1f9);
            this.pan_DockLeft.TabIndex = 0;
            this.pan_Dock.BackColor = Color.FromArgb(0, 0, 15, 0xff);
            this.pan_Dock.Controls.Add(this.pan_AllPanel);
            this.pan_Dock.Controls.Add(this.pan_DockBottom);
            this.pan_Dock.Controls.Add(this.pan_DockRight);
            this.pan_Dock.Controls.Add(this.pan_DockLeft);
            this.pan_Dock.Dock = DockStyle.Fill;
            this.pan_Dock.Location = new System.Drawing.Point(0, 0x20);
            this.pan_Dock.Name = "pan_Dock";
            this.pan_Dock.Size = new Size(0x3cb, 0x1f9);
            this.pan_Dock.TabIndex = 5;
            this.pan_AllPanel.BackColor = Color.White;
            this.pan_AllPanel.Controls.Add(this.pan_AllPlanes);
            this.pan_AllPanel.Controls.Add(this.pan_Rights);
            this.pan_AllPanel.Controls.Add(this.pan_Lefts);
            this.pan_AllPanel.Controls.Add(this.pan_Bottoms);
            this.pan_AllPanel.Controls.Add(this.pane_TopT);
            this.pan_AllPanel.Dock = DockStyle.Fill;
            this.pan_AllPanel.Location = new System.Drawing.Point(1, 0);
            this.pan_AllPanel.Name = "pan_AllPanel";
            this.pan_AllPanel.Size = new Size(0x3c9, 0x1f8);
            this.pan_AllPanel.TabIndex = 3;
            this.pan_AllPlanes.Controls.Add(this.tabControl1);
            this.pan_AllPlanes.Controls.Add(this.panel9);
            this.pan_AllPlanes.Dock = DockStyle.Fill;
            this.pan_AllPlanes.Location = new System.Drawing.Point(10, 10);
            this.pan_AllPlanes.Name = "pan_AllPlanes";
            this.pan_AllPlanes.Size = new Size(0x3b5, 0x1e4);
            this.pan_AllPlanes.TabIndex = 4;
            this.tabControl1.Controls.Add(this.tabPage1);
            this.tabControl1.Dock = DockStyle.Fill;
            this.tabControl1.Location = new System.Drawing.Point(0, 0);
            this.tabControl1.Name = "tabControl1";
            this.tabControl1.SelectedIndex = 0;
            this.tabControl1.Size = new Size(0x3b5, 0x1df);
            this.tabControl1.TabIndex = 4;
            this.tabPage1.Controls.Add(this.DataGridList);
            this.tabPage1.Controls.Add(this.PlSearch);
            this.tabPage1.Controls.Add(this.panel13);
            this.tabPage1.Controls.Add(this.panel10);
            this.tabPage1.Controls.Add(this.panel4);
            this.tabPage1.Controls.Add(this.panel8);
            this.tabPage1.Controls.Add(this.panel1);
            this.tabPage1.Controls.Add(this.pan_TopJianGe);
            this.tabPage1.Location = new System.Drawing.Point(4, 0x15);
            this.tabPage1.Name = "tabPage1";
            this.tabPage1.Padding = new Padding(3);
            this.tabPage1.Size = new Size(0x3ad, 0x1c6);
            this.tabPage1.TabIndex = 0;
            this.tabPage1.Text = "商品批次进销存查询";
            this.tabPage1.UseVisualStyleBackColor = true;
            this.DataGridList.AllowUserToAddRows = false;
            this.DataGridList.AllowUserToDeleteRows = false;
            style.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style.BackColor = Color.FromArgb(0xf9, 0xf9, 0xf9);
            this.DataGridList.AlternatingRowsDefaultCellStyle = style;
            this.DataGridList.BackgroundColor = Color.WhiteSmoke;
            this.DataGridList.BorderStyle = BorderStyle.None;
            style2.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style2.BackColor = Color.White;
            style2.Font = new System.Drawing.Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style2.ForeColor = SystemColors.WindowText;
            style2.SelectionBackColor = SystemColors.Highlight;
            style2.SelectionForeColor = SystemColors.HighlightText;
            this.DataGridList.ColumnHeadersDefaultCellStyle = style2;
            this.DataGridList.Columns.AddRange(new DataGridViewColumn[] { this.OutInCommId, this.DetailsType, this.LibraryType, this.LotNum, this.CommName, this.InputPrice, this.Amount, this.AmoutUnit, this.ResidualNum, this.ResidualMoney, this.CreateTime });
            style3.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style3.BackColor = SystemColors.Window;
            style3.Font = new System.Drawing.Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style3.ForeColor = SystemColors.ControlText;
            style3.SelectionBackColor = SystemColors.Highlight;
            style3.SelectionForeColor = SystemColors.HighlightText;
            style3.WrapMode = DataGridViewTriState.False;
            this.DataGridList.DefaultCellStyle = style3;
            this.DataGridList.Dock = DockStyle.Fill;
            this.DataGridList.EnableHeadersVisualStyles = false;
            this.DataGridList.GridColor = Color.FromArgb(0xab, 0xb9, 0x9d);
            this.DataGridList.Location = new System.Drawing.Point(3, 0x48);
            this.DataGridList.Name = "DataGridList";
            style4.Alignment = DataGridViewContentAlignment.BottomCenter;
            style4.BackColor = Color.White;
            style4.Font = new System.Drawing.Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 0x86);
            style4.ForeColor = SystemColors.WindowText;
            style4.SelectionBackColor = SystemColors.Highlight;
            style4.SelectionForeColor = SystemColors.HighlightText;
            this.DataGridList.RowHeadersDefaultCellStyle = style4;
            style5.Alignment = DataGridViewContentAlignment.MiddleCenter;
            this.DataGridList.RowsDefaultCellStyle = style5;
            this.DataGridList.RowTemplate.Height = 0x17;
            this.DataGridList.Size = new Size(0x3a7, 0x152);
            this.DataGridList.TabIndex = 14;
            this.OutInCommId.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.OutInCommId.DataPropertyName = "OutInCommId";
            style6.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style6.BackColor = Color.White;
            this.OutInCommId.DefaultCellStyle = style6;
            this.OutInCommId.HeaderText = "编号";
            this.OutInCommId.Name = "OutInCommId";
            this.OutInCommId.ReadOnly = true;
            this.OutInCommId.Visible = false;
            this.DetailsType.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.DetailsType.DataPropertyName = "DetailsType";
            style7.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style7.BackColor = Color.White;
            this.DetailsType.DefaultCellStyle = style7;
            this.DetailsType.HeaderText = "类型";
            this.DetailsType.Name = "DetailsType";
            this.DetailsType.ReadOnly = true;
            this.LibraryType.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.LibraryType.DataPropertyName = "LibraryType";
            this.LibraryType.HeaderText = "操作";
            this.LibraryType.Name = "LibraryType";
            this.LotNum.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.LotNum.DataPropertyName = "LotNum";
            style8.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style8.BackColor = Color.White;
            this.LotNum.DefaultCellStyle = style8;
            this.LotNum.HeaderText = "批号";
            this.LotNum.Name = "LotNum";
            this.LotNum.ReadOnly = true;
            this.CommName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.CommName.DataPropertyName = "CommName";
            style9.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style9.BackColor = Color.White;
            this.CommName.DefaultCellStyle = style9;
            this.CommName.HeaderText = "商品名称";
            this.CommName.Name = "CommName";
            this.CommName.ReadOnly = true;
            this.InputPrice.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.InputPrice.DataPropertyName = "InputPrice";
            style10.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style10.BackColor = Color.White;
            this.InputPrice.DefaultCellStyle = style10;
            this.InputPrice.HeaderText = "进货价";
            this.InputPrice.Name = "InputPrice";
            this.InputPrice.ReadOnly = true;
            this.Amount.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.Amount.DataPropertyName = "Amount";
            style11.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style11.BackColor = Color.White;
            this.Amount.DefaultCellStyle = style11;
            this.Amount.HeaderText = "数量";
            this.Amount.Name = "Amount";
            this.Amount.ReadOnly = true;
            this.AmoutUnit.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.AmoutUnit.DataPropertyName = "AmoutUnit";
            style12.Alignment = DataGridViewContentAlignment.MiddleCenter;
            style12.BackColor = Color.White;
            this.AmoutUnit.DefaultCellStyle = style12;
            this.AmoutUnit.HeaderText = "单位";
            this.AmoutUnit.Name = "AmoutUnit";
            this.AmoutUnit.ReadOnly = true;
            this.ResidualNum.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.ResidualNum.DataPropertyName = "ResidualNum";
            this.ResidualNum.HeaderText = "剩余库存数量";
            this.ResidualNum.Name = "ResidualNum";
            this.ResidualMoney.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.ResidualMoney.DataPropertyName = "ResidualMoney";
            this.ResidualMoney.HeaderText = "剩余库存总价";
            this.ResidualMoney.Name = "ResidualMoney";
            this.CreateTime.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
            this.CreateTime.DataPropertyName = "CreateTime";
            this.CreateTime.HeaderText = "出入库时间";
            this.CreateTime.Name = "CreateTime";
            this.PlSearch.Controls.Add(this.panel17);
            this.PlSearch.Controls.Add(this.panel18);
            this.PlSearch.Controls.Add(this.panel22);
            this.PlSearch.Controls.Add(this.panel23);
            this.PlSearch.Dock = DockStyle.Top;
            this.PlSearch.Location = new System.Drawing.Point(3, 0x2d);
            this.PlSearch.Name = "PlSearch";
            this.PlSearch.Size = new Size(0x3a7, 0x1b);
            this.PlSearch.TabIndex = 13;
            this.PlSearch.Visible = false;
            this.panel17.Controls.Add(this.txt_CommName);
            this.panel17.Dock = DockStyle.Left;
            this.panel17.Location = new System.Drawing.Point(0x11c, 0);
            this.panel17.Name = "panel17";
            this.panel17.Size = new Size(0x92, 0x1b);
            this.panel17.TabIndex = 11;
            this.txt_CommName.Location = new System.Drawing.Point(5, 3);
            this.txt_CommName.Name = "txt_CommName";
            this.txt_CommName.Size = new Size(0x89, 0x15);
            this.txt_CommName.TabIndex = 1;
            this.panel18.Controls.Add(this.label2);
            this.panel18.Dock = DockStyle.Left;
            this.panel18.Location = new System.Drawing.Point(0xd7, 0);
            this.panel18.Name = "panel18";
            this.panel18.Size = new Size(0x45, 0x1b);
            this.panel18.TabIndex = 10;
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(4, 7);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x3b, 12);
            this.label2.TabIndex = 0;
            this.label2.Text = "商品名称:";
            this.panel22.Controls.Add(this.txt_PiHao);
            this.panel22.Dock = DockStyle.Left;
            this.panel22.Location = new System.Drawing.Point(0x45, 0);
            this.panel22.Name = "panel22";
            this.panel22.Size = new Size(0x92, 0x1b);
            this.panel22.TabIndex = 9;
            this.txt_PiHao.Location = new System.Drawing.Point(5, 3);
            this.txt_PiHao.Name = "txt_PiHao";
            this.txt_PiHao.Size = new Size(0x89, 0x15);
            this.txt_PiHao.TabIndex = 0;
            this.panel23.Controls.Add(this.lbl_PiHao);
            this.panel23.Dock = DockStyle.Left;
            this.panel23.Location = new System.Drawing.Point(0, 0);
            this.panel23.Name = "panel23";
            this.panel23.Size = new Size(0x45, 0x1b);
            this.panel23.TabIndex = 8;
            this.lbl_PiHao.AutoSize = true;
            this.lbl_PiHao.Location = new System.Drawing.Point(5, 6);
            this.lbl_PiHao.Name = "lbl_PiHao";
            this.lbl_PiHao.Size = new Size(0x3b, 12);
            this.lbl_PiHao.TabIndex = 0;
            this.lbl_PiHao.Text = "商品批号:";
            this.panel13.Dock = DockStyle.Bottom;
            this.panel13.Location = new System.Drawing.Point(3, 410);
            this.panel13.Name = "panel13";
            this.panel13.Size = new Size(0x3a7, 10);
            this.panel13.TabIndex = 12;
            this.panel10.BackColor = Color.FromArgb(0xca, 0xc9, 0xce);
            this.panel10.Controls.Add(this.panel12);
            this.panel10.Controls.Add(this.panel11);
            this.panel10.Dock = DockStyle.Bottom;
            this.panel10.Location = new System.Drawing.Point(3, 420);
            this.panel10.Name = "panel10";
            this.panel10.Size = new Size(0x3a7, 0x1a);
            this.panel10.TabIndex = 11;
            this.panel12.Controls.Add(this.lblLiuXiangWhere);
            this.panel12.Controls.Add(this.lblWhere);
            this.panel12.Dock = DockStyle.Fill;
            this.panel12.Location = new System.Drawing.Point(0, 0);
            this.panel12.Name = "panel12";
            this.panel12.Size = new Size(490, 0x1a);
            this.panel12.TabIndex = 1;
            this.lblLiuXiangWhere.AutoSize = true;
            this.lblLiuXiangWhere.Location = new System.Drawing.Point(0x1a2, 8);
            this.lblLiuXiangWhere.Name = "lblLiuXiangWhere";
            this.lblLiuXiangWhere.Size = new Size(0, 12);
            this.lblLiuXiangWhere.TabIndex = 1;
            this.lblLiuXiangWhere.Visible = false;
            this.lblWhere.AutoSize = true;
            this.lblWhere.Dock = DockStyle.Right;
            this.lblWhere.Location = new System.Drawing.Point(490, 0);
            this.lblWhere.Name = "lblWhere";
            this.lblWhere.Size = new Size(0, 12);
            this.lblWhere.TabIndex = 0;
            this.lblWhere.Visible = false;
            this.panel11.Controls.Add(this.navigator_Page);
            this.panel11.Dock = DockStyle.Right;
            this.panel11.Location = new System.Drawing.Point(490, 0);
            this.panel11.Name = "panel11";
            this.panel11.Size = new Size(0x1bd, 0x1a);
            this.panel11.TabIndex = 0;
            this.navigator_Page.Dock = DockStyle.Bottom;
            this.navigator_Page.Location = new System.Drawing.Point(0, 8);
            this.navigator_Page.Name = "navigator_Page";
            this.navigator_Page.PageSize = 20;
            this.navigator_Page.RowCount = 0;
            this.navigator_Page.Size = new Size(0x1bd, 0x12);
            this.navigator_Page.TabIndex = 0;
            this.navigator_Page.OnLoadViewStatus += new Navigator.LoadViewStatusHandler(this.navigator_Page_OnLoadViewStatus);
            this.panel4.Dock = DockStyle.Bottom;
            this.panel4.Location = new System.Drawing.Point(3, 0x1be);
            this.panel4.Name = "panel4";
            this.panel4.Size = new Size(0x3a7, 5);
            this.panel4.TabIndex = 10;
            this.panel8.Dock = DockStyle.Top;
            this.panel8.Location = new System.Drawing.Point(3, 0x25);
            this.panel8.Name = "panel8";
            this.panel8.Size = new Size(0x3a7, 8);
            this.panel8.TabIndex = 8;
            this.panel1.BackColor = Color.FromArgb(0xf6, 0xf6, 0xf6);
            this.panel1.Controls.Add(this.panel7);
            this.panel1.Controls.Add(this.panel16);
            this.panel1.Controls.Add(this.panel19);
            this.panel1.Controls.Add(this.panel20);
            this.panel1.Controls.Add(this.panel3);
            this.panel1.Controls.Add(this.panel2);
            this.panel1.Dock = DockStyle.Top;
            this.panel1.Location = new System.Drawing.Point(3, 11);
            this.panel1.Name = "panel1";
            this.panel1.Size = new Size(0x3a7, 0x1a);
            this.panel1.TabIndex = 7;
            this.panel7.Controls.Add(this.btn_PrintJinHuo);
            this.panel7.Dock = DockStyle.Right;
            this.panel7.Location = new System.Drawing.Point(0x243, 3);
            this.panel7.Name = "panel7";
            this.panel7.Size = new Size(0x59, 20);
            this.panel7.TabIndex = 0x13;
            this.btn_PrintJinHuo.Dock = DockStyle.Right;
            this.btn_PrintJinHuo.Location = new System.Drawing.Point(14, 0);
            this.btn_PrintJinHuo.Name = "btn_PrintJinHuo";
            this.btn_PrintJinHuo.Size = new Size(0x4b, 20);
            this.btn_PrintJinHuo.TabIndex = 2;
            this.btn_PrintJinHuo.Text = "打 印";
            this.btn_PrintJinHuo.UseVisualStyleBackColor = true;
            this.btn_PrintJinHuo.Click += new EventHandler(this.btn_PrintJinHuo_Click);
            this.panel16.Controls.Add(this.btn_BuildProExcel);
            this.panel16.Dock = DockStyle.Right;
            this.panel16.Location = new System.Drawing.Point(0x29c, 3);
            this.panel16.Name = "panel16";
            this.panel16.Size = new Size(0x59, 20);
            this.panel16.TabIndex = 0x12;
            this.btn_BuildProExcel.Dock = DockStyle.Right;
            this.btn_BuildProExcel.Location = new System.Drawing.Point(14, 0);
            this.btn_BuildProExcel.Name = "btn_BuildProExcel";
            this.btn_BuildProExcel.Size = new Size(0x4b, 20);
            this.btn_BuildProExcel.TabIndex = 1;
            this.btn_BuildProExcel.Text = "生成报表";
            this.btn_BuildProExcel.UseVisualStyleBackColor = true;
            this.btn_BuildProExcel.Click += new EventHandler(this.btn_BuildProExcel_Click);
            this.panel19.Controls.Add(this.btnSearch);
            this.panel19.Dock = DockStyle.Right;
            this.panel19.Location = new System.Drawing.Point(0x2f5, 3);
            this.panel19.Name = "panel19";
            this.panel19.Size = new Size(0x59, 20);
            this.panel19.TabIndex = 0x11;
            this.btnSearch.Dock = DockStyle.Right;
            this.btnSearch.Location = new System.Drawing.Point(14, 0);
            this.btnSearch.Name = "btnSearch";
            this.btnSearch.Size = new Size(0x4b, 20);
            this.btnSearch.TabIndex = 1;
            this.btnSearch.Text = "查 询";
            this.btnSearch.UseVisualStyleBackColor = true;
            this.btnSearch.Click += new EventHandler(this.btnSearch_Click);
            this.panel20.Controls.Add(this.btnSearchHidden);
            this.panel20.Dock = DockStyle.Right;
            this.panel20.Location = new System.Drawing.Point(0x34e, 3);
            this.panel20.Name = "panel20";
            this.panel20.Size = new Size(0x59, 20);
            this.panel20.TabIndex = 0x10;
            this.btnSearchHidden.Dock = DockStyle.Right;
            this.btnSearchHidden.Location = new System.Drawing.Point(14, 0);
            this.btnSearchHidden.Name = "btnSearchHidden";
            this.btnSearchHidden.Size = new Size(0x4b, 20);
            this.btnSearchHidden.TabIndex = 0;
            this.btnSearchHidden.Text = "显示查询";
            this.btnSearchHidden.UseVisualStyleBackColor = true;
            this.btnSearchHidden.Click += new EventHandler(this.btnSearchHidden_Click);
            this.panel3.Dock = DockStyle.Bottom;
            this.panel3.Location = new System.Drawing.Point(0, 0x17);
            this.panel3.Name = "panel3";
            this.panel3.Size = new Size(0x3a7, 3);
            this.panel3.TabIndex = 1;
            this.panel2.Dock = DockStyle.Top;
            this.panel2.Location = new System.Drawing.Point(0, 0);
            this.panel2.Name = "panel2";
            this.panel2.Size = new Size(0x3a7, 3);
            this.panel2.TabIndex = 0;
            this.pan_TopJianGe.Dock = DockStyle.Top;
            this.pan_TopJianGe.Location = new System.Drawing.Point(3, 3);
            this.pan_TopJianGe.Name = "pan_TopJianGe";
            this.pan_TopJianGe.Size = new Size(0x3a7, 8);
            this.pan_TopJianGe.TabIndex = 5;
            this.panel9.Dock = DockStyle.Bottom;
            this.panel9.Location = new System.Drawing.Point(0, 0x1df);
            this.panel9.Name = "panel9";
            this.panel9.Size = new Size(0x3b5, 5);
            this.panel9.TabIndex = 3;
            this.pan_Rights.Dock = DockStyle.Right;
            this.pan_Rights.Location = new System.Drawing.Point(0x3bf, 10);
            this.pan_Rights.Name = "pan_Rights";
            this.pan_Rights.Size = new Size(10, 0x1e4);
            this.pan_Rights.TabIndex = 3;
            this.pan_Lefts.Dock = DockStyle.Left;
            this.pan_Lefts.Location = new System.Drawing.Point(0, 10);
            this.pan_Lefts.Name = "pan_Lefts";
            this.pan_Lefts.Size = new Size(10, 0x1e4);
            this.pan_Lefts.TabIndex = 2;
            this.pan_Bottoms.Dock = DockStyle.Bottom;
            this.pan_Bottoms.Location = new System.Drawing.Point(0, 0x1ee);
            this.pan_Bottoms.Name = "pan_Bottoms";
            this.pan_Bottoms.Size = new Size(0x3c9, 10);
            this.pan_Bottoms.TabIndex = 1;
            this.pane_TopT.Dock = DockStyle.Top;
            this.pane_TopT.Location = new System.Drawing.Point(0, 0);
            this.pane_TopT.Name = "pane_TopT";
            this.pane_TopT.Size = new Size(0x3c9, 10);
            this.pane_TopT.TabIndex = 0;
            this.pan_DockBottom.BackColor = Color.FromArgb(0xaf, 0xbf, 190);
            this.pan_DockBottom.Dock = DockStyle.Bottom;
            this.pan_DockBottom.Location = new System.Drawing.Point(1, 0x1f8);
            this.pan_DockBottom.Name = "pan_DockBottom";
            this.pan_DockBottom.Size = new Size(0x3c9, 1);
            this.pan_DockBottom.TabIndex = 2;
            this.pan_DockRight.BackColor = Color.FromArgb(0xaf, 0xbf, 190);
            this.pan_DockRight.Dock = DockStyle.Right;
            this.pan_DockRight.Location = new System.Drawing.Point(970, 0);
            this.pan_DockRight.Name = "pan_DockRight";
            this.pan_DockRight.Size = new Size(1, 0x1f9);
            this.pan_DockRight.TabIndex = 1;
            this.pan_Top.Controls.Add(this.pan_ZhongJian);
            this.pan_Top.Controls.Add(this.pan_TopRight);
            this.pan_Top.Controls.Add(this.pan_TopLeft);
            this.pan_Top.Dock = DockStyle.Top;
            this.pan_Top.Location = new System.Drawing.Point(0, 0);
            this.pan_Top.Name = "pan_Top";
            this.pan_Top.Size = new Size(0x3cb, 0x20);
            this.pan_Top.TabIndex = 4;
            this.pan_ZhongJian.BackgroundImage = Resources.uc_title_2;
            this.pan_ZhongJian.Controls.Add(this.lblTitle);
            this.pan_ZhongJian.Dock = DockStyle.Fill;
            this.pan_ZhongJian.Location = new System.Drawing.Point(0x1f, 0);
            this.pan_ZhongJian.Name = "pan_ZhongJian";
            this.pan_ZhongJian.Size = new Size(0x3a7, 0x20);
            this.pan_ZhongJian.TabIndex = 2;
            this.lblTitle.AutoSize = true;
            this.lblTitle.BackColor = Color.FromArgb(0, 0, 15, 0xff);
            this.lblTitle.Font = new System.Drawing.Font("宋体", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 0x86);
            this.lblTitle.ForeColor = Color.FromArgb(0x3b, 0x56, 20);
            this.lblTitle.Location = new System.Drawing.Point(6, 8);
            this.lblTitle.Name = "lblTitle";
            this.lblTitle.Size = new Size(0x5b, 13);
            this.lblTitle.TabIndex = 0;
            this.lblTitle.Text = "进销存明细账";
            this.pan_TopRight.BackgroundImage = Resources.uc_title_1;
            this.pan_TopRight.Dock = DockStyle.Right;
            this.pan_TopRight.Location = new System.Drawing.Point(0x3c6, 0);
            this.pan_TopRight.Name = "pan_TopRight";
            this.pan_TopRight.Size = new Size(5, 0x20);
            this.pan_TopRight.TabIndex = 1;
            this.pan_TopLeft.BackgroundImage = Resources.uc_title;
            this.pan_TopLeft.Dock = DockStyle.Left;
            this.pan_TopLeft.Location = new System.Drawing.Point(0, 0);
            this.pan_TopLeft.Name = "pan_TopLeft";
            this.pan_TopLeft.Size = new Size(0x1f, 0x20);
            this.pan_TopLeft.TabIndex = 0;
            this.saveYeWuLiuXiangDialog.DefaultExt = "xls";
            this.saveYeWuLiuXiangDialog.Filter = "报表文件|*.xls";
            this.MyPrintDocument.PrintPage += new PrintPageEventHandler(this.MyPrintDocument_PrintPage);
            base.AutoScaleDimensions = new SizeF(6f, 12f);
            base.AutoScaleMode = AutoScaleMode.Font;
            base.ClientSize = new Size(0x3cb, 0x219);
            base.Controls.Add(this.pan_Dock);
            base.Controls.Add(this.pan_Top);
            base.FormBorderStyle = FormBorderStyle.None;
            base.MaximizeBox = false;
            base.MinimizeBox = false;
            base.Name = "FrmInvoicingList";
            base.ShowInTaskbar = false;
            base.Load += new EventHandler(this.FrmInvoicingList_Load);
            this.pan_Dock.ResumeLayout(false);
            this.pan_AllPanel.ResumeLayout(false);
            this.pan_AllPlanes.ResumeLayout(false);
            this.tabControl1.ResumeLayout(false);
            this.tabPage1.ResumeLayout(false);
            ((ISupportInitialize) this.DataGridList).EndInit();
            this.PlSearch.ResumeLayout(false);
            this.panel17.ResumeLayout(false);
            this.panel17.PerformLayout();
            this.panel18.ResumeLayout(false);
            this.panel18.PerformLayout();
            this.panel22.ResumeLayout(false);
            this.panel22.PerformLayout();
            this.panel23.ResumeLayout(false);
            this.panel23.PerformLayout();
            this.panel10.ResumeLayout(false);
            this.panel12.ResumeLayout(false);
            this.panel12.PerformLayout();
            this.panel11.ResumeLayout(false);
            this.panel1.ResumeLayout(false);
            this.panel7.ResumeLayout(false);
            this.panel16.ResumeLayout(false);
            this.panel19.ResumeLayout(false);
            this.panel20.ResumeLayout(false);
            this.pan_Top.ResumeLayout(false);
            this.pan_ZhongJian.ResumeLayout(false);
            this.pan_ZhongJian.PerformLayout();
            base.ResumeLayout(false);
        }

        private void MyPrintDocument_PrintPage(object sender, PrintPageEventArgs e)
        {
            if (this.MyDataGridViewPrinter.DrawDataGridView(e.Graphics))
            {
                e.HasMorePages = true;
            }
        }

        private void navigator_Page_OnLoadViewStatus()
        {
            this.DataLoad();
            this.navigator_Page.PageSize = 0x11;
            this.navigator_Page.DataContainer = this.DataGridList;
            this.navigator_Page.DataBind();
        }

        private bool SetupThePrinting()
        {
            PrintDialog dialog = new PrintDialog {
                AllowCurrentPage = false,
                AllowPrintToFile = false,
                AllowSelection = false,
                AllowSomePages = false,
                PrintToFile = false,
                ShowHelp = false,
                ShowNetwork = false
            };
            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return false;
            }
            this.MyPrintDocument.DocumentName = "商品进销存明细账";
            this.MyPrintDocument.PrinterSettings = dialog.PrinterSettings;
            this.MyPrintDocument.DefaultPageSettings = dialog.PrinterSettings.DefaultPageSettings;
            this.MyPrintDocument.DefaultPageSettings.Margins = new Margins(30, 30, 30, 30);
            this.MyDataGridViewPrinter = new DataGridViewPrinter(this.DataGridList, this.MyPrintDocument, true, true, "商品进销存明细账", new System.Drawing.Font("宋体", 16f, FontStyle.Bold, GraphicsUnit.Point), Color.Black, true);
            return true;
        }
    }
}

